<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script>
        function save(key) {
            // localStorage 是持久保存
            sessionStorage.setItem(key, document.getElementById(key).value);
            console.log('save ' + key + ' done');
        }
        function load(key) {
            // localStorage 是持久保存
            var value = sessionStorage.getItem(key);
            console.log('load ' + key + '=' + value);
        }

        function clear(){
            localStorage.clear(); // clear all localstorage
            sessionStorage.clear();
        }
    </script>
</head>
<body>

<input type="text" name="input" id="input"/>
<input type="button" value="save" onclick="save('input')"/>
<input type="button" value="load" onclick="load('input')"/>
</body>
</html>